#include <iostream>
#include "lib.h"

using namespace std;

int main(){

    try{
        double x[] = {1, 2, 3, 4};
        double y[] = {0, 12, 10, 0};
        double sx = 2.2;
        int n = sizeof(x)/sizeof(double);
        if(n != 4)
            throw "Wrong number count";
        
        if(getD(x, y, sx, 1, 0) < 14.2 or getD(x, y, sx, 1, 0) > 14.5)
            throw "Wrong first getD";
        
        
        double rez = getval(x, y, sx, n);
        
        if(rez < 11 or rez > 13)
            throw "Wrong rez";
        
        cout << "Rez: " << rez << endl;
    }
    catch(const char e[]){
        cout << "Error: " << e << endl;
    }
    
    return 0;
}
